<?php 
    include_once('../includes/common.inc.php');
    include_once("../dal/bookDAL.php");
    if(isset($_GET["bookId_array"]))
    {
        $count = count($_GET['bookId_array']);
        for ($i=0; $i<$count; $i++){ 
            $bookId_array[$i] = $_GET['bookId_array'][$i];
        }
        $bookDAL = new BookDAL();
        $count = $bookDAL->deleteBooks($bookId_array);
        if($count > 0)
        {
            header("Location:books.php?message=Bạn đã delete " . $count . " cuốn sách thành công");
        }
        else
        {
            header("Location:book.php?error_message=Delete sách thất bại");
        }
    }
    
?>